package cn.snowheart.strategy.duck.entity;

import cn.snowheart.strategy.duck.flyable.FlyBehavior;
import cn.snowheart.strategy.duck.quackable.QuackBehavior;

/**
 * @author liuwanxiang
 * @version 2019/06/24
 */
public abstract class Duck {

    protected FlyBehavior flyBehavior;

    protected QuackBehavior quackBehavior;

    public abstract void display();

    public void performQuack() {
        quackBehavior.quack();
    }

    public void performFly() {
        flyBehavior.fly();
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }
}
